﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_DSNhaPhanPhoi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    private void MessageBox(string msg, int type)
    {
        if (type == 0)
        {
            Page.Controls.Add(new LiteralControl(
           "<script language='javascript'> window.alert('" + msg.Replace("'", "\\'") + "');location.href='DSNhaPhanPhoi.aspx';</script>"));
        }
        else
        {
            Page.Controls.Add(new LiteralControl(
            "<script language='javascript'> window.alert('" + msg.Replace("'", "\\'") + "');location.href='DSNhaPhanPhoi.aspx?loaisp=" + int.Parse(Request.QueryString["loaisp"]) + "';</script>"));
        }
    }
    protected void lkbtnThem_Click(object sender, EventArgs e)
    {
        NhaPhanPhoiDTO nppDto = new NhaPhanPhoiDTO();
        nppDto.TenNPP = txtTenNPP.Text;

        NhaPhanPhoiBUS objNPP = new NhaPhanPhoiBUS(TGDDConfiguration.DbConnectionString);
        if (objNPP.InsertNhaPhanPhoi(nppDto))
        {
            MessageBox("Thêm thành công", 0);
        }
        else
        {
            MessageBox("Thêm thất bại", 0);
        }
    }
}
